package org.example.myleet.p674;

public class Solution {
    /**
     * 1 ms
     * 简单地比较上一个与下一个的大小，记录连续递增的子序列的开始与结束位置
     */
    public int findLengthOfLCIS(int[] nums) {
        if (nums.length == 0) {
            return 0;
        }
        int maxLen = 1, start = 0, end = 0;
        for (int i=1; i<nums.length; i++) {
            if (nums[i] > nums[i-1]) {
                ++end;
            } else {
                maxLen = Math.max(maxLen, end - start + 1);
                start = i;
                end = i;
            }
        }
        maxLen = Math.max(maxLen, end - start + 1);
        return maxLen;
    }
}
